package exception;

public class ThrowsDemo {
    public static void main(String[] args) {

        Student lx=new Student();
        try {
            lx.setAge(-30);
        } catch (IllegalAgeException e) {
            e.printStackTrace();//打印错误栈跟踪信息
            System.out.println(e.getMessage());
        }
        System.out.println("此人年龄为："+lx.getAge()+"岁");
    }
}
